package com.itheima.service.db.impl;

import com.itheima.domain.db.soul.SoulResult;
import com.itheima.mapper.SoulResultMapper;
import com.itheima.service.db.SoulResultService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

@Service
public class SoulResultServiceImpl implements SoulResultService {

    @Autowired
    SoulResultMapper soulResultMapper;

    @Override
    public SoulResult findById(Long id) {

        return soulResultMapper.selectById(id);
    }

    @Override
    public SoulResult findByScore(int score) {
        Long id = 0L;
        if (score >=0 && score<= 20){
            id =1L;
        }else if (score >=21 && score<= 40){
            id = 2L;
        }else if (score >=41 && score<= 55){
            id = 3L;
        }else if (score >=56 && score<= 100){
            id = 4L;
        }
        return soulResultMapper.selectById(id);

    }
}
